
// <copyright file="ListDynamicIntelligentCopyHelper.cs" company="Subhadra Software Solutions">
//   
// </copyright>
// <summary>
//   This class has some helper methods that will be called by DynamicIntelligentCopyHelper.
// </summary>

namespace SubhadraSolutions.Sharp.Utils.Reflection.Internal
{
    using System.Collections.Generic;

    /// <summary>
    /// /// This class has some helper methods that will be called by DynamicIntelligentCopyHelper.
    /// </summary>
    /// <typeparam name="TS">
    /// The type of the arguments.
    /// </typeparam>
    /// <typeparam name="TT">
    /// The type of the attribute.
    /// </typeparam>
    internal class ListDynamicIntelligentCopyHelper<TS, TT>
        where TT : new()
    {
        #region Public Methods and Operators

        /// <summary>
        /// Copies the specified sources.
        /// </summary>
        /// <param name="sources">
        /// The sources.
        /// </param>
        /// <param name="targets">
        /// The targets.
        /// </param>
        public static void Copy(IEnumerable<TS> sources, IList<TT> targets)
        {
            foreach (TS source in sources)
            {
                var target = new TT();
                targets.Add(target);
                DynamicIntelligentCopyHelper<TS, TT>.Copy(source, target);
            }
        }

        #endregion Public Methods and Operators
    }
}
